<include file="Public/head" />
<style type="text/css">
    .marks .marks-l{width:12%;height:100%;float:left;}
    .marks .marks-r{width:82%;height:100%;float:left;}
    .marks .marks-r span{width:100px;height:32px;line-height:32px;margin-right:20px;color:#333333;
                         background-color:#ccc;border: 1px solid #999999; float:left;display:block;}
    .tijiao-marks{margin-top: 30px;}
    .tijiao-marks input{
        background: #20ab4f none repeat scroll 0 0;border: 1px solid #20ab4f;border-radius: 3px;color: #fff;
        cursor: pointer;font-size: 14px; height: 30px;line-height: 30px;margin: 30px 10px;text-align: center;width: 170px;}
    .car_info{margin:10px 20px;}
    .car_info .car_no{width:100%;height:36px;margin-bottom:10px;}
    .car_info .car_no span{width:150px;height:36px;line-height:36px;display:block;float:left;background-color:#20ab4f;border:1px solid #FFF;color:#fff;text-align:center;border-radius:5px}
    .car_info table tr td{height:30px;text-align:left;font-size:12px;padding-left:10px;}
    .clear{clear:both;}
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="cyxs.xs" />

    <div class="mianR">
        <h3 class='cha'>上架详情</h3>
        <div class='car_info'>
            <div class='car_no'><span>车辆编号：{$list.car_no}</span></div>
            <div class='clear'></div>
            <table border='1' width='80%'>
                <tbody>
                    <tr>
                        <td colspan='4'><span  style='color:#20ab4f'>车辆信息</span></td>
                    </tr>
                    <tr>
                        <td>车型</td>
                        <td>{$list.car_model}</td>
                        <td>排放标准</td>
                        <td>{$list.emission}</td>
                    </tr>
                    <tr>
                        <td>初登日期</td>
                        <td>{$list.first_reg_date}</td>
                        <td>颜色</td>
                        <td>{$list.car_color}</td>
                    </tr>
                    <tr>
                        <td>表显里程（万公里）</td>
                        <td>{$list.pointer_mileage}</td>
                        <td>车况级别</td>
                        <td>{$list.chek_level}</td>
                    </tr>
                    <tr>
                        <td>车辆注册地</td>
                        <td>{$list.first_reg_city}</td>
                        <td>车牌号</td>
                        <td>{$list.chepai_hao}</td>
                    </tr>
                    <tr>
                        <td>车架号</td>
                        <td>{$list.vin}</td>
                        <td>销售价</td>
                        <td>{$list.reserve_price}</td>
                    </tr>
                </tbody>
            </table>
            <table border='1' width='80%' style='margin-top:20px;'>
                <tbody>
                    <tr>
                        <td colspan='4'><span style='color:#20ab4f'>车主信息</span></td>
                    </tr>
                    <tr>
                        <td>车主类型</td>
                        <td>{$list.owner_type_name}</td>
                        <if condition="$list.owner_type eq 1">
                            <td>车主姓名</td>
                            <td>{$list.seller_name}</td>
                            <else />
                            <td>公司名称</td>
                            <td>{$list.seller_name}</td>
                        </if>
                        <if condition="$list.owner_type eq 1">
                            <td>联系电话</td>
                            <td>{$list.phone}</td>
                            <else />
                            <td>联系人姓名</td>
                            <td>{$list.contact_person}</td>
                            <td>联系电话</td>
                            <td>{$list.phone}</td>
                        </if>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="marks">
            <div class="marks-l">
                <h2 style="background-color:#FFF">请选择标签：</h2>
            </div>
            <div class="marks-r">
                <volist name="car_marks" id="vo" key="key">
                    <span onclick="select_mark({$key})" id="mark_{$key}" isselect="1">{$vo}</span>
                </volist>
<!--                <span onclick="select_mark(1)" id="mark_1" isselect="1">准新车</span>
                <span onclick="select_mark(2)" id="mark_2" isselect="1">高性能</span>
                <span onclick="select_mark(3)" id="mark_3" isselect="1">车主急卖</span>-->
            </div>
            <div class="tijiao-marks">
                <input type="button" name="submit_marks" value="提交">
                <input name="cancel" type="reset" class="quxiao" value="取消"/>
            </div>
        </div>
    </div>
    <div class="clear"></div>
    <script type="text/javascript">
        function select_mark(id) {
            var obj = $("#mark_" + id);
            var isselect = obj.attr('isselect');
            if (isselect == 1) {
                obj.css({"background-color": "#20ab4f", "color": "#FFF"});
                obj.attr("isselect", "2");
            } else {
                obj.css({"background-color": "#CCCCCC", "color": "#333"});
                obj.attr("isselect", "1");
            }
        }
        $("input[name='submit_marks']").on('click', function () {
            var sel_str = '';
            $(".marks-r span").each(function (index) {
                if (index <= 2) {
                    sel_val = $(this).attr('isselect');
                    sel_mark = $(this).html();
                    if (sel_val == '2') {
                        sel_str += sel_mark + "、";
                    }
                } else {
                    shibai_alert("最多选择三个标签");
                }
            });
            if (sel_str == '') {
                shibai_alert("请选择标签");
                return false;
            }
            var param = {
                "sale_id": {$sale_id},
                "car_marks": sel_str
            }
            $.post("{:U('CarShow/up_post')}", param, function (res) {
                if (res.code == 200) {
                    btn_alert(res.msg);
                    setTimeout(function () {
                        window.location.href = "{:U('CarShow/index')}"+'?car_status='+{$list.car_status}+"&p="+{$p};
                    }, 2000);
                } else {
                    shibai_alert(res.msg);
                }
            }, 'json');
        });
        $("input[name='cancel']").on("click", function () {
            setTimeout(function () {
                window.location.href = "{:U('CarShow/index')}"+'?car_status='+{$list.car_status}+"&p="+{$p};
            }, 500);
        });
    </script>
    <include file="Public/foot" />
